The dealer who sold him the drugs, they said, is an ex-con who had a gun in his car.
Both are now facing serious charges.
Working from a tip, Bureau of Narcotics detectives watched as Andre Morales, 36, sold some drugs to Luis Santos, 50, near the corner of Marshal and Slater streets from his 2012 Chevy Cruze, Passaic County Sheriff Richard Berdnik said.
The detectives grabbed each of them at separate locations moments later, the sheriff said.
Santos "violently attacked" them and tried to run but was captured, Berdnik said. He was carrying 130 heroin folds and half an ounce of raw cocaine, he said.
The detectives sustained minor injuries, as did Santos, who was treated at St. Joseph's University Medical Center before being released into their custody, the sheriff said.
Morales, meanwhile, was found with a small clear, knotted plastic bag containing a small amount of crack and $293 in suspected drug proceeds, Berdnik said.
A search of the Chevy also turned up a Taurus .38 Special revolver reported stolen out of North Carolina and loaded with six polymer-tip hollow-point founds of ammunition, he said.
Santos was charged with drug offenses as well as two counts of aggravated assault on a police officer, resisting arrest and various drug offenses.
Morales was charged with various gun and weapons offenses, including illegally possessing a firearm as a convicted felon.
Both men remained held in the Bergen County Jail on Saturday, Sept. 30.
Click here to follow Daily Voice Fort Lee and receive free news updates.